<?php
namespace Api\Controller;
use Think\Controller;

class ErrorController extends Controller
{
    /**
     * @var array 系统错误代码
     */
    private $errCode = array(
        '000000' => '成功',
        '100000' => '用户名或密码错误',
        '100001' => '帐户未启用',
        '100002' => '您无权使用',
        '100003' => '密码修改失败',
        '100004' => '原密码不正确',
        '100005' => '暂无信息',
        '100006' => '余额不足',
        '100007' => '暂无信息',
        '100008' => '修改失败',

        '200000' => '暂无订单数据',
        '200001' => '订单号出错',
        '200002' => '二维码扫码出错',
        '200003' => '操作订单出错',

        '500000' => '地址有误，请详细填写',
        '500001' => '收件地址有误，请详细填写',
        '500002' => '寄件地址有误，请详细填写',
        '500005' => '距离计算出错',
        '500010' => '地址坐标转换出错',
        '500011' => '收件地址坐标转换出错',
        '500012' => '寄件地址坐标转换出错',
        '500009' => '地图服务出错',

        '700001' => '文件大小超出服务器限制',
        '700002' => '文件大小超出浏览器限制',
        '700003' => '文件上传系统出错',
        '700004' => '文件上传系统出错',
        '700005' => '文件上传系统出错',
        '700006' => '文件上传系统出错',
        '700010' => '文件格式出错',
        '700011' => '文件大小超出系统限制',
        '700012' => '图片比例不正确',
        '700013' => '图片高宽超出系统限制',

        '800000' => '已经是最新版本',
        '800001' => '有新的版本可以更新',


        '900000' => '提交方式出错',
        '900001' => 'COMMAND出错',
        '900002' => '请求超时',
        '900003' => '必传参数不存在或者为空',
        '900004' => '订单编号错误',
        '999999' => '系统错误',
        '999998' => '错误码不存在',

        '110000' => '只有客服账号才能登陆',
        '110001' => '该用户没有所属角色',
        '110002' => '员工账号不能登陆',
        '110003' => '该员工账号已下班',
        '110004' => '核心端处理数据失败',
        '110005' => '没有该用户',
        'code_fail'=>'获得token失败'
    );

    /**
     * 查找CODE对应的说明
     * @param $eCode 错误代码
     */
    public function searchCode($eCode){
        if(isset($this->errCode[$eCode])){
            return $this->errCode[$eCode];
        }else{
            return $this->errCode['999998'];
        }
    }
}